import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace RefSpaBookingApi {
  /** SPA预订信息 */
  export interface RefSpaBooking {
    id: number; // 
    bookingId?: string; // 预订ID
    orderId: string; // 关联订单ID
    serviceId?: string; // 服务ID
    customerId?: string; // 客户ID
    appointmentTime?: string | Dayjs; // 预约时间
    duration: number; // 时长(分钟)
    price: number; // 价格
    status: string; // 预订状态
  }
}

/** 查询SPA预订分页 */
export function getRefSpaBookingPage(params: PageParam) {
  return requestClient.get<PageResult<RefSpaBookingApi.RefSpaBooking>>('/wedding/ref-spa-booking/page', { params });
}

/** 查询SPA预订详情 */
export function getRefSpaBooking(id: number) {
  return requestClient.get<RefSpaBookingApi.RefSpaBooking>(`/wedding/ref-spa-booking/get?id=${id}`);
}

/** 新增SPA预订 */
export function createRefSpaBooking(data: RefSpaBookingApi.RefSpaBooking) {
  return requestClient.post('/wedding/ref-spa-booking/create', data);
}

/** 修改SPA预订 */
export function updateRefSpaBooking(data: RefSpaBookingApi.RefSpaBooking) {
  return requestClient.put('/wedding/ref-spa-booking/update', data);
}

/** 删除SPA预订 */
export function deleteRefSpaBooking(id: number) {
  return requestClient.delete(`/wedding/ref-spa-booking/delete?id=${id}`);
}


/** 导出SPA预订 */
export function exportRefSpaBooking(params: any) {
  return requestClient.download('/wedding/ref-spa-booking/export-excel', { params });
}

